cmake_minimum_required(VERSION 3.16)
project(StaticLibExp VERSION 1.0 LANGUAGES C CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

# Set up AUTOMOC and some sensible defaults for runtime execution
# When using Qt 6.3, you can replace the code block below with
# qt_standard_project_setup()
set(CMAKE_AUTOMOC ON)
include(GNUInstallDirs)

find_package(QT NAMES Qt5 Qt6 REQUIRED COMPONENTS Core)
find_package(Qt${QT_VERSION_MAJOR}  REQUIRED COMPONENTS Core)

add_library(StaticLibExp STATIC CmdExc.cpp CmdExc.h IpDealer.cpp IpDealer.h StaticLibExp.cpp StaticLibExp.h)
target_compile_definitions(StaticLibExp PUBLIC
    QT_DEPRECATED_WARNINGS
)

target_link_libraries(StaticLibExp PUBLIC
    IPHLPAPI.DLL
    Qt::Core
    WS2_32.DLL
)

install(TARGETS StaticLibExp
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    FRAMEWORK DESTINATION ${CMAKE_INSTALL_LIBDIR}
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
